﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConfigServices
{
    /// <summary>
    /// ini文件配置
    /// </summary>
    public class IniFileConfigService : IConfigService
    {
        public string FilePath { get; set; }

        public string GetValue(string name)
        {
            var kv = File.ReadAllLines("mail.ini").Select(a => a.Split("=")).Select(strs => new
            {
                Name = strs[0],
                Value = strs[1]
            }).SingleOrDefault(kv => kv.Name == name);

            if (kv != null)
            {
                return kv.Value;
            }

            return null;
        }
    }
}
